//
//  OCSSOrderDetailFirstFooterView.swift
//  OCSSStoreSwift
//
//  Created by MacMiniKangChe on 2018/10/16.
//  Copyright © 2018年 MacMiniKangChe. All rights reserved.
//

import UIKit
import SwiftyJSON

class OCSSOrderDetailFirstFooterView: OCSSBaseView {

    @IBOutlet weak var totalPrice: UILabel! //商品总价
    @IBOutlet weak var discountPrice: UILabel! //优惠金额
    @IBOutlet weak var receiveMoney: UILabel! //已收金额
    @IBOutlet weak var debtMoney: UILabel! //待收金额
    @IBOutlet weak var deliveryType: UILabel! //配送方式
    @IBOutlet weak var payType: UILabel! //支付方式
    @IBOutlet weak var customerName: UILabel! //客户姓名
    @IBOutlet weak var customerPhone: UILabel! //客户电话
    @IBOutlet weak var customerRemark: UILabel! //客户备注
    @IBOutlet weak var deliveryRemark: UILabel! //配送备注
    @IBOutlet weak var sellsman: UILabel! //销售员
    @IBOutlet weak var serialsNum: UILabel! //单位编号
    @IBOutlet weak var sourceNum: UILabel! //来源单号
    @IBOutlet weak var createTime: UILabel! //创建时间
    
    override func setView(info: [String:JSON]) {
        let stockOutModel = JSON(info["stockOutModel"]!).dictionaryValue;
        totalPrice.text = "￥"+JSON(stockOutModel["OrderTotalAmount"]!).stringValue;
        discountPrice.text = "￥"+JSON(stockOutModel["DiscountTotalAmount"]!).stringValue;
        receiveMoney.text = "￥"+JSON(stockOutModel["ReceivedAmount"]!).stringValue;
        debtMoney.text = "￥"+JSON(stockOutModel["ReceivedAmount"]!).stringValue;
        deliveryType.text = JSON(stockOutModel["DistributionTypeName"]!).stringValue;
        let payT = JSON(stockOutModel["PayType"]!).intValue;
        var payTypeStr = "";
        switch payT {
            case 10:
                payTypeStr = "现金";
                break;
            case 20:
                payTypeStr = "微信";
                break;
            case 30:
                payTypeStr = "支付宝";
                break;
            case 40:
                payTypeStr = "经销商预存";
                break;
            case 60:
                payTypeStr = "转账";
                break;
            default:
                break;
        }
        payType.text = payTypeStr;
        customerName.text = JSON(stockOutModel["CustomerName"]!).stringValue;
        customerPhone.text = JSON(stockOutModel["MobilePhoneNumber"]!).stringValue;
        customerRemark.text = JSON(stockOutModel["CustomerMessage"]!).stringValue;
        deliveryRemark.text = JSON(stockOutModel["Remarks"]!).stringValue;
        
        serialsNum.text = JSON(stockOutModel["OrderID"]!).stringValue;
        sourceNum.text = JSON(stockOutModel["ID"]!).stringValue;
        var timeStr = JSON(stockOutModel["CreatedDate"]!).stringValue as NSString;
        timeStr = timeStr.replacingOccurrences(of: "T", with: " ") as NSString;
        createTime.text = timeStr as String;
    }
    
    
}
